# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>

pkgname=python-setproctitle
pkgver=1.3.2
pkgrel=2
pkgdesc="Allows a python process to change its process title"
license=("BSD")
url="https://github.com/dvarrazzo/py-setproctitle"
depends=('python')
makedepends=(python-setuptools python-wheel python-build python-installer)
checkdepends=('python-pytest' 'procps-ng')
arch=('loong64' 'x86_64')
source=(https://files.pythonhosted.org/packages/source/s/setproctitle/setproctitle-$pkgver.tar.gz)
sha256sums=('b9fb97907c830d260fa0658ed58afd48a86b2b88aac521135c352ff7fd3477fd')

build() {
    cd "$srcdir"/setproctitle-$pkgver
    python -m build --wheel --no-isolation
}

check() {
    local _pyver=$(python -c "import sys; print('{0}{1}'.format(*sys.version_info[:2]))")
    cd "$srcdir"/setproctitle-$pkgver/build/lib.linux-$CARCH-cpython-$_pyver
    python -m pytest ../../tests
}

package_python-setproctitle() {
    cd "$srcdir"/setproctitle-$pkgver
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -m0644 -D COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/COPYRIGHT"
}
